package com.bailian.web.controller.system;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.bailian.common.annotation.Log;
import com.bailian.common.core.controller.BaseController;
import com.bailian.common.core.domain.AjaxResult;
import com.bailian.common.enums.BusinessType;
import com.bailian.system.domain.BlParkConfig;
import com.bailian.system.service.IBlParkConfigService;
import com.bailian.common.utils.poi.ExcelUtil;
import com.bailian.common.core.page.TableDataInfo;

/**
 * 园区仓库配置Controller
 * 
 * @author bailian
 * @date 2025-08-04
 */
@RestController
@RequestMapping("/system/park_config")
public class BlParkConfigController extends BaseController
{
    @Autowired
    private IBlParkConfigService blParkConfigService;

    /**
     * 查询园区仓库配置列表
     */
    @PreAuthorize("@ss.hasPermi('system:park_config:list')")
    @GetMapping("/list")
    public TableDataInfo list(BlParkConfig blParkConfig)
    {
        startPage();
        List<BlParkConfig> list = blParkConfigService.selectBlParkConfigList(blParkConfig);
        return getDataTable(list);
    }

    /**
     * 导出园区仓库配置列表
     */
    @PreAuthorize("@ss.hasPermi('system:park_config:export')")
    @Log(title = "园区仓库配置", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, BlParkConfig blParkConfig)
    {
        List<BlParkConfig> list = blParkConfigService.selectBlParkConfigList(blParkConfig);
        ExcelUtil<BlParkConfig> util = new ExcelUtil<BlParkConfig>(BlParkConfig.class);
        util.exportExcel(response, list, "园区仓库配置数据");
    }

    /**
     * 获取园区仓库配置详细信息
     */
    @PreAuthorize("@ss.hasPermi('system:park_config:query')")
    @GetMapping(value = "/{configId}")
    public AjaxResult getInfo(@PathVariable("configId") Long configId)
    {
        return success(blParkConfigService.selectBlParkConfigByConfigId(configId));
    }

    /**
     * 新增园区仓库配置
     */
    @PreAuthorize("@ss.hasPermi('system:park_config:add')")
    @Log(title = "园区仓库配置", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody BlParkConfig blParkConfig)
    {
        return toAjax(blParkConfigService.insertBlParkConfig(blParkConfig));
    }

    /**
     * 修改园区仓库配置
     */
    @PreAuthorize("@ss.hasPermi('system:park_config:edit')")
    @Log(title = "园区仓库配置", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody BlParkConfig blParkConfig)
    {
        return toAjax(blParkConfigService.updateBlParkConfig(blParkConfig));
    }

    /**
     * 删除园区仓库配置
     */
    @PreAuthorize("@ss.hasPermi('system:park_config:remove')")
    @Log(title = "园区仓库配置", businessType = BusinessType.DELETE)
	@DeleteMapping("/{configIds}")
    public AjaxResult remove(@PathVariable Long[] configIds)
    {
        return toAjax(blParkConfigService.deleteBlParkConfigByConfigIds(configIds));
    }
}
